package com.drcoffee.drcoffeemall.controller;

import com.drcoffee.drcoffeemall.entry.FAQ;
import com.drcoffee.drcoffeemall.service.FAQService;
import com.drcoffee.drcoffeemall.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/faq")
public class FAQController {
    @Autowired
    FAQService faqService;

    @GetMapping("/getFAQ")
    public Map<String, Object> getFAQ( @RequestParam String language,@RequestParam(required = false)  Integer machine_id, @RequestParam String search) {
        return faqService.getFAQ(language,machine_id, search);
    }

    @GetMapping("/getFaqAll")
    public Map<String, Object> getFaqAll() {
        return faqService.getFaqAll();
    }

    @PostMapping("/updateFaq")
    public Map<String, Object> updateFaq(@RequestBody FAQ faq) {
        return faqService.updateFaq(faq);
    }


    @PostMapping("/addFAQ")
    public Map<String, Object> addFAQ(@RequestBody FAQ faq) {
        return faqService.addFAQ(faq);
    }

    @GetMapping("/deleteFAQ")
    public Map<String, Object> deleteFAQ(@RequestParam Integer id) {
        return faqService.deleteFAQ(id);
    }

}
